# $NetBSD: Makefile,v 1.32 2023/01/24 18:36:28 wiz Exp $

.include "../../wip/llvm/version.mk"

DISTNAME=	libunwind-${LLVM_VERSION}.src
PKGNAME=	${DISTNAME:S/.src//}
CATEGORIES=	lang devel

MAINTAINER=	pkgsrc-users@NetBSD.org
#HOMEPAGE=	http://libunwind.llvm.org/
COMMENT=	LLVM libunwind
LICENSE=	apache-2.0

# libunwind requires libcxx source code to build
LIBCXX=		libcxx-${LLVM_VERSION}.src
EXTRA_DIST+=	${LIBCXX}${EXTRACT_SUFX}

SITES.${LIBCXX}${EXTRACT_SUFX}=	\
	${MASTER_SITES:=${GITHUB_PROJECT}/releases/download/${GITHUB_RELEASE}/}

USE_LANGUAGES=		c c++11
USE_TOOLS+=		pax
SSP_SUPPORTED=		no
GCC_REQD+=		10	# must be in sync with libcxx

CMAKE_ARGS+=	-DCMAKE_BUILD_TYPE=Release

INSTALLATION_DIRS=	include

post-extract:
	${LN} -f -s ${WRKDIR}/${LIBCXX} ${WRKDIR}/libcxx

post-install:
	cd ${WRKSRC}/include && ${PAX} -rw . ${DESTDIR}${PREFIX}/include

.include "../../devel/cmake/build.mk"
BUILDLINK_DEPMETHOD.llvm=	build
.include "../../wip/llvm/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
